package com.company.huisuo.biz.adapter

import android.app.Activity
import android.view.LayoutInflater
import android.view.ViewGroup
import com.company.huisuo.base.BaseSingleAdapter
import com.company.huisuo.biz.dialog.FeedBackInputDialog
import com.company.huisuo.databinding.ItemDanceFeedbackBinding
import com.company.huisuo.ext.loadImg
import com.lxj.xpopup.XPopup


class DanceFeedBackAdapter : BaseSingleAdapter<Int, ItemDanceFeedbackBinding>() {

    override val initViewBinding: (LayoutInflater, ViewGroup, Boolean) -> ItemDanceFeedbackBinding
        get() = ItemDanceFeedbackBinding::inflate

    override fun convert(
        holder: SingleViewHolder<ItemDanceFeedbackBinding>,
        position: Int,
        item: Int?
    ) {
        holder.binding.ivAvatar.loadImg(item ?: 0)
        holder.binding.tvFeedback.setOnClickListener {
            XPopup.Builder(context)
                .moveUpToKeyboard(false)
                .asCustom(FeedBackInputDialog(context as Activity)).show()
        }
    }
}